<?php 

echo html_writer::start_tag('div', array('id' => 'msgshell'));

if ($arrResult) 
{
    // Вывод сообщения
    echo html_writer::start_tag('div', array('id' => 'onemsg'));
    
    echo html_writer::tag('p', '#'.$arrResult[0]['id'], array('class' => 'detail'));
    echo html_writer::tag('p', 'author:&nbsp;&nbsp;'.$arrResult[0]['author'], array('class' => 'author'));
    echo html_writer::tag('h3', $arrResult[0]['title'], array());    
    echo html_writer::tag('p', $arrResult[0]['text'], array('class' => 'text'));
    
    // ссылка на главную
    $ref = $DOF->url_im('guestbook', '/index.php', array());
    $homelink = html_writer::link($ref, 'go home', array());
    $gohome = html_writer::tag('span', $homelink, array('class' => 'gohome'));
    
    // дата и счетчик комментариев
    $date = html_writer::tag('span', $arrResult[0]['date'], array('class' => 'date'));
    $comments = html_writer::tag('span', '&nbsp;&nbsp;comments:('.$arrResult[0]['commentcnt'].')', array('class' => 'comment'));
    
    echo html_writer::tag('p', $gohome.$date.$comments, array('class' => 'dateComment'));  
    
    echo html_writer::end_tag('div');
    
    echo html_writer::end_tag('div');
    
    // блок с комментариями
    echo html_writer::start_tag('div', array('class' => 'comments'));
    
    echo html_writer::tag('h4', 'Comments:', array('class' => 'title')); 
    
    if (!empty($arrResult['COMMENTS'])) 
    {
        foreach ($arrResult['COMMENTS'] as $key => $value) 
        {
            echo html_writer::start_tag('div', array('id' => 'comment'));
            
            echo html_writer::tag('h5', 'written by:&nbsp;'.$value['author'], array('class' => 'cauthor'));
            echo html_writer::tag('p', $value['text'], array('class' => 'text'));
            echo html_writer::tag('p', $value['date'], array('class' => 'dateComment'));
            
            
            echo html_writer::end_tag('div');
        }
    }
    else 
    {
        echo html_writer::start_tag('div', array('id' => 'comment'));
        echo html_writer::tag('h5', 'written by:&nbsp;System', array('class' => 'cauthor'));
        echo html_writer::tag('p', 'No comments here', array('class' => 'text'));
        echo html_writer::tag('p', 'today', array('class' => 'dateComment'));
        echo html_writer::end_tag('div');
    }
    
    echo html_writer::end_tag('div');
}
else 
{
    echo html_writer::tag('h2', 'Page is not found', array());
}

?>